#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,n,a[1000];
    while(scanf("%d",&n)!=EOF){
            if(n==0||n>55){break;}
            else if(n<=4){
                printf("%d\n",n);
            }else{
                a[0]=1;
                a[1]=2;
                a[2]=3;
                a[3]=4;
                for(i=4;i<n;i++){
                      a[i]=a[i-1]+a[i-3];
                }
                printf("%d\n",a[i-1]);
            }
    }
    return 0;
}
